package org.hyl.javabase.集合扩展;

import java.util.ArrayList;
import java.util.List;

public class sqlList implements sql  {
	List<Object> al = new ArrayList<Object>();
	String tablename;

	public String toString(){
		//String s=super.toString();
		return "tablename="+tablename;
	}
	public Object get(){
		return al;		
	}
	public sqlList(String name) {
		tablename = name;
	}
	
	public void select(int i) {
		if (al.isEmpty()) return;
		if (al.size()-1<i) return;
		try{
			System.out.println("row[" + i + "]=" + al.get(i));}
		catch(Exception e){
			
		}
	}

	public void selectall() {
		for (int i = 0; i < al.size(); i++) {
			System.out.println("row[" + i + "]=" + al.get(i));
		}
	}
	public boolean find(Object o){
		return al.contains(o);
	}
	public void insert(Object o) {
		al.add(o);
		// 添加元素
		// c.add("孙悟空");
		// 虽然集合里不能放基本类型的值，但Java支持自动装箱
		// c.add(6);
	}

	public void update(int i, Object o) {
		al.set(i, o);
	}

	public void delete(int i) {
		al.remove(i);
	}

	public void insert(int i, Object o) {
		al.add(i, o);

	}
	public void clear(){
		al.clear();
	}
	 public int size(){
		 return al.size();
	 }

}
